home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / nerak2.zip / DESCOBJ.SCR < prev    next >
Text File  |  1995-09-24  |  6KB  |  165 lines

  1. !
  2. ! Script Name: DESCOBJ.SCR
  3. !
  4. ! This script can be called from any other script to describe a given
  5. ! object.  The object is identified by the OBJECT variable which must
  6. ! point to an existing object (not being carried by anyone).
  7. !
  8. ! To look at an item being carried by someone, you should call the
  9. ! CURRITEM script which performs the same function on the 'curritem'
  10. ! variable.
  11. !
  12. !    Example:
  13. !      curritem = player.weapon;
  14. !      runscript( curritem.script, "CURRITEM", EXAMINE );
  15. !
  16. !------------------------------------------------------------------------!
  17. ! :@TALK   ! No talking in this script..
  18. !------------------------------------------------------------------------!
  19. ! :@GET    ! No getting in this script
  20. !------------------------------------------------------------------------!
  21. ! :@DROP   ! No droping in this script
  22. !------------------------------------------------------------------------!
  23. ! :@WEAR   ! No wearing or wielding stuff
  24. !------------------------------------------------------------------------!
  25. ! :@REMOVE ! No removing either..
  26. !------------------------------------------------------------------------!
  27.  
  28. !------------------------------------------------------------------------!
  29. :@LOOK     ! Finally something we can do!!!! 
  30. !------------------------------------------------------------------------!
  31.   L(255) = FALSE;   ! Set a flag so the subroutine does not give a 
  32.                     ! full description (i.e. LOOK, not EXAMINE)
  33.   gosub DESCRIBE;
  34.   STOP;
  35.  
  36. !------------------------------------------------------------------------!
  37. :@EXAMINE   ! Examine the object in detail                               !
  38. !------------------------------------------------------------------------!
  39.   L(255) = TRUE;   ! Give DETAILED description !
  40.   gosub DESCRIBE;
  41.   STOP;
  42.  
  43. !------------------------------------------------------------------------!
  44. !
  45. ! SUBROUTINE: DESCRIBE
  46. !
  47. ! This routine is invoked from @LOOK, @EXAMINE 
  48. !
  49. !------------------------------------------------------------------------!
  50. :DESCRIBE
  51. !------------------------------------------------------------------------!
  52.   if object.count = 0 then
  53.     writeln( "DBG: Opps. There is nothing to look at in DESCOBJ.SCR" );
  54.     STOP;
  55.   endif;
  56.   if object.picture >= 0 then
  57.     viewpcx( object );
  58.     if success then
  59.       pause;
  60.     endif;
  61.     paint(window); ! Assumes the picture fits in the window !
  62.   elsif object.type = SIGN or object.type = BOOK then
  63.     readtext( object.text );
  64.     STOP;
  65.   endif;
  66.   write( "You see a ", object.name );
  67.   if NOT L(255) then
  68.     writeln;
  69.     STOP;
  70.   endif;
  71.   write( ", Type: ", object.type );
  72. !
  73. ! The following is a 'cascading if..then..elsif..elsif.....else..endif' 
  74. ! statement.  It is used here to illustrate it's usefulness.  The same
  75. ! code could have been written with a 'ON object.type GOTO' statement.
  76. !
  77.   if object.type = FOOD or object.type = POTION  then
  78.     if object.class then
  79.       write( ", Class: ", object.class );
  80.       if object.class <> CURE then
  81.         write( ", Units: ", object.units );
  82.       endif;
  83.     endif;
  84.   elsif object.type = WEAPON then
  85.     write( ", Class: ", object.class, 
  86.            ", Hands: ", object.hands, 
  87.            ", Range: ", object.range, 
  88.            ", Damage: ", object.damage );
  89.     if object.ammoneeded then
  90.       write( ", Needs ammo type: ", object.ammo_type );
  91.     endif;
  92.   elsif object.type = AMMO then
  93.     write( ", Ammo Type: ", object.ammotype );
  94.     if object.traptype then
  95.       write( ", Poisoned" );
  96.     endif;
  97.     if object.damage then
  98.       write( ", Extra Damage: ", object.damage );
  99.     endif;
  100.   elsif object.type = ARMOR or object.type = SHIELD then
  101.     write( ", Armor Class: ", object.ac );
  102.     if object.cursed then
  103.       write( " Cursed!" );
  104.     endif;
  105.   elsif object.type = AMULET or object.type = RING or object.type = GEMS then
  106.     if object.class then
  107.       write( ", Class: ", object.class );
  108.       write( ", Charges: ", object.charges );
  109.       if object.class <> CURE then
  110.         write( ", Units: ", object.units );
  111.         if object.permanent then
  112.           write( ", Permanent!" );
  113.         else
  114.           write( ", Temporary" );
  115.         endif;
  116.       endif;
  117.       if object.cursed then
  118.         write( ", Cursed!" );
  119.       endif;
  120.     endif;
  121.   elsif object.type = SCROLL then
  122.     write( ", Class: ", object.class );
  123.   elsif object.type = STAFF then
  124.     write( ", Class: ", object.class, ", Charges: ", object.charges );
  125.   elsif object.type = CHEST then
  126.     if object.locktype then
  127.       write( ", Locked!" );
  128.       if object.traptype = 0 then
  129.         write( ", no traps" );
  130.       elsif object.traptype = 1 then
  131.         write( ", poison trap" );
  132.       else
  133.         write( ", bomb damage: ", object.traptype );
  134.       endif;
  135.     endif;
  136. ! elsif object.type = KEYS     then
  137. !   nothing special about it
  138. ! elsif object.type = BOOK     then
  139. !   nothing special about it
  140. ! elsif object.type = GOLDSACK then
  141. !   nothing special about it
  142. ! elsif object.type = TORCH    then
  143. !   nothing special about it
  144. ! elsif object.type = LANTERN  then
  145. !   nothing special about it
  146. ! elsif object.type = ROPE     then
  147. !   nothing special about it
  148. ! elsif object.type = HOOKS    then
  149. !   nothing special about it
  150. ! elsif object.type = MIRROR   then
  151. !   nothing special about it
  152. ! elsif object.type = SIGN     then
  153. !   nothing special about it
  154.   elsif object.type = VEHICLE then
  155.     write( ", Class: ", object.class );
  156. ! else
  157. !   user defined type?
  158.   endif;
  159.   if object.weight > 1 and object.weight < 256 then
  160.     write( ", Weight: ", object.weight );
  161.   endif;
  162.   writeln( "." );
  163.   return;
  164.  
  165.